package cn.doit.scala.day04

/**
 * @DATE 2021/12/28/9:39
 * @Author MDK
 * @Version 2021.2.2
 * */
object C03_Grouped {
  def main(args: Array[String]): Unit = {
    //将集合中的元素  按照顺序两两进行分组
    val list= List(1,2,3,4,5,6,1,2,3)
    val iterator: Iterator[List[Int]] = list.grouped(2)
    iterator.foreach(println)

    val mp = Map("peiqi"->3, "john"->5,"Gorge"->12)
    val res = mp.grouped(2)
    res.foreach(println)
  }
}
